# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-flexmock
pkgver=0.11.3
pkgrel=2
pkgdesc="Mock/Stub/Spy library for Python"
arch=('any')
license=('BSD')
url="https://flexmock.readthedocs.io"
depends=('python')
makedepends=('python-setuptools')
checkdepends=('python-pytest' 'python-teamcity-messages' 'python-testtools' 'python-twisted')
source=("https://github.com/flexmock/flexmock/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('58c84317fb687fd708db7c909fe7109b8b9c37a932fd1a46c9f62d28bbcc56a807b35a6790bf1393289f85fdffdfa2367f7ccc05bff260a167731471a50d2685')

export LC_CTYPE=en_US.UTF-8

prepare() {
  cd flexmock-$pkgver
  sed -i 's/PYTHONPATH=\$(shell pwd) //' Makefile
}

build() {
  cd flexmock-$pkgver
  python setup.py build
}

check() {
  cd flexmock-$pkgver
  PYTHONPATH="$PWD":"$PWD"/build/lib make test
}

package() {
  cd flexmock-$pkgver
  python setup.py install --root="$pkgdir" --optimize=1
  install -D -m644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
